package com.vertx.firstvertx;

import io.vertx.core.Vertx;
import io.vertx.core.http.HttpServer;
import io.vertx.core.http.HttpServerResponse;

import java.time.LocalDateTime;

public class HelloVertx {

	public static void main(String[] args) {

		Vertx vertx = Vertx.vertx();

		HttpServer server = vertx.createHttpServer();

		server.requestHandler(request -> {

			// This handler gets called for each request that arrives on the server
			HttpServerResponse response = request.response();
			response.putHeader("content-type", "text/plain");

			// Write to the response and end it
			response.end("Hello World!  " + LocalDateTime.now());
		});

		server.listen(8080);

		System.out.println("finish startup");

	}

}
